import java.util.Scanner;
public class homework20250210 {
    public static void main(String[] args) {

    }
    public static void main5(String[] args) {//辗转相除求最大公约数
        int a = 24;
        int b = 18;
        int c = a % b;//6
        while (c != 0){
            a = b;//18
            b = c;//6
            c = a%b;//0
        }
        System.out.println(b);//6
    }
    public static void main4(String[] args) {//输出二进制序列奇数列与偶数列
        int n = 7;
        for (int i = 0; i < 32; i+=2) {
            System.out.print(((n >> i) & 1) + " ");
        }
        System.out.println();
        for (int i = 30; i >=0 ;i-=2 ) {//奇数位的
            System.out.print(((n >> i)&1) + " ");
        }
        System.out.println();
        for (int i = 31; i >= 0; i-=2) {//偶数位的
            System.out.print(((n >> i)&1) + " ");
        }
    }
    public static void main3(String[] args) {//输入密码
        Scanner in = new Scanner(System.in);
        int count = 3;
        while(count!=0){
            System.out.println("请输入你的密码：你还有 " + count + "次机会");//流变量创建
            String pass = in.nextLine();//用流变量.调用方法
            if(pass.equals("123456")){//字符串变量.调用字符串相等判断方法
                System.out.println("登录成功");
                break;
            }else{
                count--;
                System.out.println("密码错误");
            }
        }
    }
    public static void main2(String[] args) {//算1/1 - 1/2 + 1/3 +…… 1/100
        double sum = 0;
        int flg = 1;
        for (int i = 1; i <= 100 ; i++) {
            sum+=1.0/i*flg;
            flg = -flg;
        }
        System.out.println(sum);
    }
    public static void main1(String[] args) {//1~100整数里出现的数字9的个数
        int count = 0;
        for (int i = 1; i <=100; i++) {
            if(i / 10 == 9){
                //十位是9
                count++;
            }
            if(i % 10 == 9){
                //个位是9
                count++;
            }
        }
        System.out.println(count);
    }
}
